package edu.nanyang.dao;

import edu.nanyang.domain.AcademyInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AcademyInfoDao {
    @Delete("delete from academy_info where id=#{id}")
    int delete(int id);

    @Insert("insert into academy_info(academy_name,create_time) values(#{academyName},now())")
    int add(AcademyInfo academyInfo);

    @Update("update academy_info set academy_name=#{academyName},operate_time=now() where id=#{id}")
    int update(AcademyInfo academyInfo);

    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "academyName", column = "academy_name"),
            @Result(property = "createTime", column = "create_time")
    })
    @Select("select * from academy_info where id=#{id}")
    AcademyInfo getById(int id);

    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "academyName", column = "academy_name"),
            @Result(property = "createTime", column = "create_time")
    })
    @Select("select * from academy_info")
    List<AcademyInfo> findAll();




}
